/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.util.ArrayList;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;

/**
 *
 * @author minaev
 */
public class LegendListCellRender implements ListCellRenderer<Object> {

    ArrayList<Color> txt_colors = new ArrayList<Color>();
    DefaultListCellRenderer dcr = new DefaultListCellRenderer();
    
    public LegendListCellRender(ArrayList<Color> clrs) {
        this.txt_colors = clrs;
    }

    @Override
    public Component getListCellRendererComponent(JList<? extends Object> list,
            Object value, int index,
            boolean isSelected, boolean cellHasFocus) {
        JLabel lbl = (JLabel) dcr.getListCellRendererComponent(
                list,value,index, isSelected, cellHasFocus);
        
        lbl.setForeground(txt_colors.get(index));
        

        return lbl;
    }
}
